﻿using System;

namespace HslCommunication.Core.IMessage
{
	/// <summary>
	/// LSIS的PLC的FastEnet的消息定义
	/// </summary>
	// Token: 0x0200015B RID: 347
	public class LsisFastEnetMessage : INetMessage
	{
		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ProtocolHeadBytesLength" />
		// Token: 0x170005EB RID: 1515
		// (get) Token: 0x06001D62 RID: 7522 RVA: 0x0008D543 File Offset: 0x0008B743
		public int ProtocolHeadBytesLength
		{
			get
			{
				return 20;
			}
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.HeadBytes" />
		// Token: 0x170005EC RID: 1516
		// (get) Token: 0x06001D63 RID: 7523 RVA: 0x0008D547 File Offset: 0x0008B747
		// (set) Token: 0x06001D64 RID: 7524 RVA: 0x0008D54F File Offset: 0x0008B74F
		public byte[] HeadBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ContentBytes" />
		// Token: 0x170005ED RID: 1517
		// (get) Token: 0x06001D65 RID: 7525 RVA: 0x0008D558 File Offset: 0x0008B758
		// (set) Token: 0x06001D66 RID: 7526 RVA: 0x0008D560 File Offset: 0x0008B760
		public byte[] ContentBytes { get; set; }

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.CheckHeadBytesLegal(System.Byte[])" />
		// Token: 0x06001D67 RID: 7527 RVA: 0x0008D56C File Offset: 0x0008B76C
		public bool CheckHeadBytesLegal(byte[] token)
		{
			bool flag = this.HeadBytes == null;
			return !flag && this.HeadBytes[0] == 76;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetContentLengthByHeadBytes" />
		// Token: 0x06001D68 RID: 7528 RVA: 0x0008D59C File Offset: 0x0008B79C
		public int GetContentLengthByHeadBytes()
		{
			byte[] headBytes = this.HeadBytes;
			bool flag = headBytes != null && headBytes.Length >= 20;
			int result;
			if (flag)
			{
				result = (int)BitConverter.ToUInt16(this.HeadBytes, 16);
			}
			else
			{
				result = 0;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetHeadBytesIdentity" />
		// Token: 0x06001D69 RID: 7529 RVA: 0x0008D5D9 File Offset: 0x0008B7D9
		public int GetHeadBytesIdentity()
		{
			return (int)BitConverter.ToUInt16(this.HeadBytes, 14);
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.SendBytes" />
		// Token: 0x170005EE RID: 1518
		// (get) Token: 0x06001D6A RID: 7530 RVA: 0x0008D5E8 File Offset: 0x0008B7E8
		// (set) Token: 0x06001D6B RID: 7531 RVA: 0x0008D5F0 File Offset: 0x0008B7F0
		public byte[] SendBytes { get; set; }
	}
}
